﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ScarfMaker
{
    /// <summary>
    /// MsgControl.xaml 的交互逻辑
    /// </summary>
    public partial class MsgControl : Window
    {
        public MsgControl(ImageSource imgs)
        {
            InitializeComponent();
            imgMaterial.Source = imgs;
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void Window_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            if(e.Delta<0)
            {

                if ((double)imgMaterial.GetValue(HeightProperty) + e.Delta < 200 || (double)imgMaterial.GetValue(HeightProperty) + e.Delta < 200)
                {
                    imgMaterial.SetValue(HeightProperty, (double)100);
                    imgMaterial.SetValue(WidthProperty, (double)100);
                }
            }
            imgMaterial.SetValue(HeightProperty,(double)imgMaterial.GetValue(HeightProperty)+ e.Delta/5);
            imgMaterial.SetValue(WidthProperty, (double)imgMaterial.GetValue(WidthProperty) + e.Delta/5);
        }
    }
}
